package converter;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
import javax.faces.convert.FacesConverter;

import metiers.Concept;

@FacesConverter(forClass = Concept.class)
public class ConverterConcept implements Converter{
	
	public ConverterConcept() {
		super();
	}

	public Object getAsObject(FacesContext facesContext, UIComponent component,
			String value) throws ConverterException {

		return new Concept(value);
	}

	public String getAsString(FacesContext facesContext, UIComponent component,
			Object object) throws ConverterException {
		return (object == null) ? new String() : ((Concept) object)
				.getNom();
	}

}
